import java.util.ArrayList;
import java.util.List;

/**
create by Kingchin Wong on 2016/6/1
*/

public class AList{
	public static void main(String []args){
		
		//create a array's list object.
		List<String> list = new ArrayList<String>();
		//this ctor could create a object containing n elements.
		//List<String> list = new ArrayList<String>(n);
		
		//size() method returns the size of object who calls. 
		System.out.println("the size of list is: " + list.size());

		//add elements to list.
		list.add("Jone");
		list.add("Mary");
		list.add("Kingchin");
		
		//show the emelents of list
		System.out.println("list:");
		for(String str:list){
			System.out.println(str);
		}
		
		//show the size of list again
		System.out.println("the size of list is: " + list.size());
		
		//get() method
		for(int index = 0;index < list.size();index++){
			System.out.println("No." + index + " is: " + list.get(index));
		}
		
		//set() method
		int i = 0;
		list.set(i,"Hellen");
		System.out.println("No.0" + " is: " + list.get(i));
		
	}
}